Skip to content

test(query-core/utils): assert exact booleans with 'toBe' instead of 'toEqual'#11070

Merged
sukvvon merged 1 commit into
mainfrom
test/query-core-utils-boolean-tobe
Jul 17, 2026
Merged

test(query-core/utils): assert exact booleans with 'toBe' instead of 'toEqual'#11070
sukvvon merged 1 commit into
mainfrom
test/query-core-utils-boolean-tobe

Conversation

@sukvvon

@sukvvon sukvvon commented Jul 17, 2026

Copy link
Copy Markdown
Member

🎯 Changes

Replaces toEqual(true/false) with toBe(true/false) in query-core utils tests.

All these assertions compare boolean literals, so toBe is the exact matcher — deep equality has nothing to traverse here. This file was the outlier: it used toEqual 26 times against toBe 14, while the rest of query-core already favors toBe for booleans. Follows up on #11043.

Affected describes: shallowEqualObjects, isPlainObject, isPlainArray, partialMatchKey, isValidTimeout.

Non-boolean toEqual assertions in this file are left untouched.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Standardized test assertions for utility functions.
    • Improved formatting and consistency without changing tested behavior.

@nx-cloud

nx-cloud Bot commented Jul 17, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 86e5b11

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 8m 8s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 46s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-17 03:47:29 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2a1e3e17-be3d-4fcf-a90b-3cf5fb477fa9

📥 Commits

Reviewing files that changed from the base of the PR and between a9aa23f and 86e5b11.

📒 Files selected for processing (1)
  • packages/query-core/src/__tests__/utils.test.tsx

📝 Walkthrough

Walkthrough

Updated query-core utility tests to use Vitest’s strict toBe(...) matcher for boolean and primitive-returning helpers, including shallowEqualObjects, isPlainArray, partialMatchKey, and isValidTimeout. No production code or public APIs changed.

Changes

Utility test assertion updates

Layer / File(s) Summary
Strict boolean matcher updates
packages/query-core/src/__tests__/utils.test.tsx
Replaced toEqual(...) with toBe(...) for utility helper results and reformatted selected partialMatchKey expectations without changing test conditions.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • TanStack/query#11043: Updates related utility test assertions in the same test file to use stricter boolean checks.
  • TanStack/query#11048: Changes assertions in the same test file toward strict toBe behavior.
  • TanStack/query#11049: Applies similar strict boolean matcher updates to other query-related tests.

Suggested reviewers: whizzkid1452

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: switching boolean assertions from toEqual to toBe in query-core utils tests.
Description check ✅ Passed The description matches the required template and includes the changes, checklist, and release impact sections with relevant details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/query-core-utils-boolean-tobe

Comment @coderabbitai help to get the list of available commands.

@sukvvon sukvvon self-assigned this Jul 17, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@11070

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@11070

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11070

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@11070

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@11070

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@11070

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@11070

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@11070

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@11070

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@11070

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@11070

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@11070

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@11070

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@11070

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@11070

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@11070

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@11070

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@11070

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@11070

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@11070

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@11070

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@11070

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@11070

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@11070

commit: 86e5b11

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.13 KB (0%)
react minimal 9.08 KB (0%)

@sukvvon
sukvvon merged commit 80b833e into main Jul 17, 2026
9 checks passed
@sukvvon
sukvvon deleted the test/query-core-utils-boolean-tobe branch July 17, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant